# Base image
FROM node:20.14-alpine AS base
FROM base AS build
COPY . /root/
# 切换目录
WORKDIR /root
RUN npm config set registry https://mirrors.huaweicloud.com/repository/npm/
RUN npm install -g pnpm
RUN npx pnpm config set registry https://mirrors.huaweicloud.com/repository/npm/
RUN npx pnpm install
RUN npx pnpm run build

FROM nginx:1.19.0 AS production
COPY --from=build /root/dist /usr/share/nginx/html/
COPY ./docker_files/default.conf /etc/nginx/conf.d/